package cn.edu.scau.cmi.dengzejun.comprehensive;

import java.util.ArrayList;
import java.util.Arrays;

public class Source {
	public String[] getFinalSource(String[] strings) {
		ArrayList<String> aList = new ArrayList<String>();
		for (int i = 0; i < strings.length; ++i) {
			int end = strings[i].length();
			int start = 0;
			String temp = null;
			boolean flag = false;
			char[] tempArray = strings[i].toCharArray();
			for (int j = strings[i].length() - 1; j >= 0; --j) {
				if (tempArray[j] == ' ' || tempArray[j] == '\t') {
					if (flag) {
						start = j + 1;
						break;
					}
					continue;
				} else {
					flag = true;
				}
			}
			temp = strings[i].substring(start, end);
			aList.add(temp);
		}
		String[] temps;
		Object[] object = aList.toArray();
		temps = Arrays.copyOf(object, object.length, String[].class);
		return temps;
	}

}
